/*
-----------------------------------------------------------------------------
This source file is part of Labor3D
(Labor 3D Graphics Engine)

Copyright (c) 2009-2020 Rock Mao
* creator : Rock Mao
* created : 2011-2-11   11:37
* filename: LaborBaseModel.h
-----------------------------------------------------------------------------
*/

#ifndef __LABORBASEMODEL_H__
#define __LABORBASEMODEL_H__
#include "../LaborCoreDef.h"
#include "../Common/LaborBaseObject.h"
#include "../Common/LaborObjectFactory.h"
#include "../Renderer/LaborTextureManager.h"
#include "LaborModelDecl.h"
#include "LaborMeshReadWriter.h"
#include "../Renderer/LaborRenderSysObjest.h"

NAMESPACE_LABOR3D_BEGIN

class LABORCORE_API CLBaseModel : public IRenderSysResource
{
	    IMPL_BASE_OBJECT_INTERFACE(CLBaseModel);
protected:
	LaborBaseTextureMgr*  m_pTexMgr;
	vHBaseMeshs           m_hBaseMeshs; 
	std::ds_wstring       m_name;
	CLAABB                m_aabb;
public:
	CLBaseModel(LaborBaseTextureMgr* pTexMgr , bool bSysMemCopy = false);
	virtual ~CLBaseModel();
public:
	virtual bool                load(const wchar_t* fileName , unsigned long  arg);
	virtual bool                load(const wchar_t* fileName , const xint8_u* buf , size_t bufLen, unsigned long arg);
	virtual bool                isLoaded();
	virtual bool                unload();
	virtual unsigned long memUsage();

	virtual bool                render();
public:
	const wchar_t*         name();
	void                   setName(const wchar_t* _name);

};
DECL_OBJECT_FACTORY_AND_MGR(CLBaseModel, CLBaseModelCreator , CLBaseModelCreatorMgr , LaborBaseTextureMgr* , bool);

NAMESPACE_LABOR3D_END

#endif // __LABORBASEMODEL_H__
